// wglutils.cpp
//

#include "config.h"
#include "wgl/wglutils.hpp"

#include <fstream>



// wgl::utils::read_file
//
std::vector<char> wgl::utils::read_file ( const std::string &filename )
{
  std::ifstream file(filename, std::ios::ate | std::ios::binary);
  if (!file.is_open())
    WGL_ERROR("could not open file '%s'", filename.c_str());

  size_t size = (size_t) file.tellg();
  std::vector<char> buffer(size);
  file.seekg(0);
  file.read(buffer.data(), size);
  file.close();

  return buffer;
}
